home *** CD-ROM | disk | FTP | other *** search
/ Kellogg's Amérique / Kellogg's Amérique / main.swf / scripts / fl / controls / SelectableList.as < prev    next >
Text File  |  2020-08-04  |  22KB  |  747 lines

  1. package fl.controls
  2. {
  3.    import fl.containers.BaseScrollPane;
  4.    import fl.controls.listClasses.CellRenderer;
  5.    import fl.controls.listClasses.ICellRenderer;
  6.    import fl.core.InvalidationType;
  7.    import fl.data.DataProvider;
  8.    import fl.data.SimpleCollectionItem;
  9.    import fl.events.DataChangeEvent;
  10.    import fl.events.DataChangeType;
  11.    import fl.events.ListEvent;
  12.    import fl.events.ScrollEvent;
  13.    import fl.managers.IFocusManagerComponent;
  14.    import flash.display.DisplayObject;
  15.    import flash.display.Sprite;
  16.    import flash.events.Event;
  17.    import flash.events.KeyboardEvent;
  18.    import flash.events.MouseEvent;
  19.    import flash.ui.Keyboard;
  20.    import flash.utils.Dictionary;
  21.    
  22.    public class SelectableList extends BaseScrollPane implements IFocusManagerComponent
  23.    {
  24.       
  25.       private static var defaultStyles:Object = {
  26.          "skin":"List_skin",
  27.          "cellRenderer":CellRenderer,
  28.          "contentPadding":null,
  29.          "disabledAlpha":null
  30.       };
  31.       
  32.       public static var createAccessibilityImplementation:Function;
  33.        
  34.       
  35.       protected var invalidItems:Dictionary;
  36.       
  37.       protected var renderedItems:Dictionary;
  38.       
  39.       protected var listHolder:Sprite;
  40.       
  41.       protected var _allowMultipleSelection:Boolean = false;
  42.       
  43.       protected var lastCaretIndex:int = -1;
  44.       
  45.       protected var _selectedIndices:Array;
  46.       
  47.       protected var availableCellRenderers:Array;
  48.       
  49.       protected var list:Sprite;
  50.       
  51.       protected var caretIndex:int = -1;
  52.       
  53.       protected var updatedRendererStyles:Object;
  54.       
  55.       protected var preChangeItems:Array;
  56.       
  57.       protected var activeCellRenderers:Array;
  58.       
  59.       protected var rendererStyles:Object;
  60.       
  61.       protected var _verticalScrollPosition:Number;
  62.       
  63.       protected var _dataProvider:DataProvider;
  64.       
  65.       protected var _horizontalScrollPosition:Number;
  66.       
  67.       private var collectionItemImport:SimpleCollectionItem;
  68.       
  69.       protected var _selectable:Boolean = true;
  70.       
  71.       public function SelectableList()
  72.       {
  73.          _allowMultipleSelection = false;
  74.          _selectable = true;
  75.          caretIndex = -1;
  76.          lastCaretIndex = -1;
  77.          super();
  78.          activeCellRenderers = [];
  79.          availableCellRenderers = [];
  80.          invalidItems = new Dictionary(true);
  81.          renderedItems = new Dictionary(true);
  82.          _selectedIndices = [];
  83.          if(dataProvider == null)
  84.          {
  85.             dataProvider = new DataProvider();
  86.          }
  87.          verticalScrollPolicy = ScrollPolicy.AUTO;
  88.          rendererStyles = {};
  89.          updatedRendererStyles = {};
  90.       }
  91.       
  92.       public static function getStyleDefinition() : Object
  93.       {
  94.          return mergeStyles(defaultStyles,BaseScrollPane.getStyleDefinition());
  95.       }
  96.       
  97.       protected function drawList() : void
  98.       {
  99.       }
  100.       
  101.       public function set allowMultipleSelection(param1:Boolean) : void
  102.       {
  103.          if(param1 == _allowMultipleSelection)
  104.          {
  105.             return;
  106.          }
  107.          _allowMultipleSelection = param1;
  108.          if(!param1 && _selectedIndices.length > 1)
  109.          {
  110.             _selectedIndices = [_selectedIndices.pop()];
  111.             invalidate(InvalidationType.DATA);
  112.          }
  113.       }
  114.       
  115.       public function sortItemsOn(param1:String, param2:Object = null) : *
  116.       {
  117.          return _dataProvider.sortOn(param1,param2);
  118.       }
  119.       
  120.       public function removeItemAt(param1:uint) : Object
  121.       {
  122.          return _dataProvider.removeItemAt(param1);
  123.       }
  124.       
  125.       public function get selectedItem() : Object
  126.       {
  127.          return _selectedIndices.length == 0 ? null : _dataProvider.getItemAt(selectedIndex);
  128.       }
  129.       
  130.       override protected function keyDownHandler(param1:KeyboardEvent) : void
  131.       {
  132.          if(!selectable)
  133.          {
  134.             return;
  135.          }
  136.          switch(param1.keyCode)
  137.          {
  138.             case Keyboard.UP:
  139.             case Keyboard.DOWN:
  140.             case Keyboard.END:
  141.             case Keyboard.HOME:
  142.             case Keyboard.PAGE_UP:
  143.             case Keyboard.PAGE_DOWN:
  144.                moveSelectionVertically(param1.keyCode,param1.shiftKey && _allowMultipleSelection,param1.ctrlKey && _allowMultipleSelection);
  145.                param1.stopPropagation();
  146.                break;
  147.             case Keyboard.LEFT:
  148.             case Keyboard.RIGHT:
  149.                moveSelectionHorizontally(param1.keyCode,param1.shiftKey && _allowMultipleSelection,param1.ctrlKey && _allowMultipleSelection);
  150.                param1.stopPropagation();
  151.          }
  152.       }
  153.       
  154.       public function get selectable() : Boolean
  155.       {
  156.          return _selectable;
  157.       }
  158.       
  159.       public function itemToCellRenderer(param1:Object) : ICellRenderer
  160.       {
  161.          var _loc2_:* = undefined;
  162.          var _loc3_:ICellRenderer = null;
  163.          if(param1 != null)
  164.          {
  165.             for(_loc2_ in activeCellRenderers)
  166.             {
  167.                _loc3_ = activeCellRenderers[_loc2_] as ICellRenderer;
  168.                if(_loc3_.data == param1)
  169.                {
  170.                   return _loc3_;
  171.                }
  172.             }
  173.          }
  174.          return null;
  175.       }
  176.       
  177.       public function getNextIndexAtLetter(param1:String, param2:int = -1) : int
  178.       {
  179.          var _loc3_:int = 0;
  180.          var _loc4_:Number = NaN;
  181.          var _loc5_:Number = NaN;
  182.          var _loc6_:Object = null;
  183.          var _loc7_:String = null;
  184.          if(length == 0)
  185.          {
  186.             return -1;
  187.          }
  188.          param1 = param1.toUpperCase();
  189.          _loc3_ = length - 1;
  190.          _loc4_ = 0;
  191.          while(_loc4_ < _loc3_)
  192.          {
  193.             if((_loc5_ = param2 + 1 + _loc4_) > length - 1)
  194.             {
  195.                _loc5_ -= length;
  196.             }
  197.             if((_loc6_ = getItemAt(_loc5_)) == null)
  198.             {
  199.                break;
  200.             }
  201.             if((_loc7_ = itemToLabel(_loc6_)) != null)
  202.             {
  203.                if(_loc7_.charAt(0).toUpperCase() == param1)
  204.                {
  205.                   return _loc5_;
  206.                }
  207.             }
  208.             _loc4_++;
  209.          }
  210.          return -1;
  211.       }
  212.       
  213.       public function invalidateList() : void
  214.       {
  215.          _invalidateList();
  216.          invalidate(InvalidationType.DATA);
  217.       }
  218.       
  219.       override public function set enabled(param1:Boolean) : void
  220.       {
  221.          super.enabled = param1;
  222.          list.mouseChildren = _enabled;
  223.       }
  224.       
  225.       public function get selectedIndices() : Array
  226.       {
  227.          return _selectedIndices.concat();
  228.       }
  229.       
  230.       public function set selectable(param1:Boolean) : void
  231.       {
  232.          if(param1 == _selectable)
  233.          {
  234.             return;
  235.          }
  236.          if(!param1)
  237.          {
  238.             selectedIndices = [];
  239.          }
  240.          _selectable = param1;
  241.       }
  242.       
  243.       public function itemToLabel(param1:Object) : String
  244.       {
  245.          return param1["label"];
  246.       }
  247.       
  248.       public function addItemAt(param1:Object, param2:uint) : void
  249.       {
  250.          _dataProvider.addItemAt(param1,param2);
  251.          invalidateList();
  252.       }
  253.       
  254.       public function replaceItemAt(param1:Object, param2:uint) : Object
  255.       {
  256.          return _dataProvider.replaceItemAt(param1,param2);
  257.       }
  258.       
  259.       protected function handleDataChange(param1:DataChangeEvent) : void
  260.       {
  261.          var _loc2_:int = 0;
  262.          var _loc3_:int = 0;
  263.          var _loc4_:String = null;
  264.          var _loc5_:uint = 0;
  265.          _loc2_ = param1.startIndex;
  266.          _loc3_ = param1.endIndex;
  267.          if((_loc4_ = param1.changeType) == DataChangeType.INVALIDATE_ALL)
  268.          {
  269.             clearSelection();
  270.             invalidateList();
  271.          }
  272.          else if(_loc4_ == DataChangeType.INVALIDATE)
  273.          {
  274.             _loc5_ = 0;
  275.             while(_loc5_ < param1.items.length)
  276.             {
  277.                invalidateItem(param1.items[_loc5_]);
  278.                _loc5_++;
  279.             }
  280.          }
  281.          else if(_loc4_ == DataChangeType.ADD)
  282.          {
  283.             _loc5_ = 0;
  284.             while(_loc5_ < _selectedIndices.length)
  285.             {
  286.                if(_selectedIndices[_loc5_] >= _loc2_)
  287.                {
  288.                   _selectedIndices[_loc5_] += _loc2_ - _loc3_;
  289.                }
  290.                _loc5_++;
  291.             }
  292.          }
  293.          else if(_loc4_ == DataChangeType.REMOVE)
  294.          {
  295.             _loc5_ = 0;
  296.             while(_loc5_ < _selectedIndices.length)
  297.             {
  298.                if(_selectedIndices[_loc5_] >= _loc2_)
  299.                {
  300.                   if(_selectedIndices[_loc5_] <= _loc3_)
  301.                   {
  302.                      delete _selectedIndices[_loc5_];
  303.                   }
  304.                   else
  305.                   {
  306.                      _selectedIndices[_loc5_] -= _loc2_ - _loc3_ + 1;
  307.                   }
  308.                }
  309.                _loc5_++;
  310.             }
  311.          }
  312.          else if(_loc4_ == DataChangeType.REMOVE_ALL)
  313.          {
  314.             clearSelection();
  315.          }
  316.          else if(_loc4_ != DataChangeType.REPLACE)
  317.          {
  318.             selectedItems = preChangeItems;
  319.             preChangeItems = null;
  320.          }
  321.          invalidate(InvalidationType.DATA);
  322.       }
  323.       
  324.       protected function _invalidateList() : void
  325.       {
  326.          availableCellRenderers = [];
  327.          while(activeCellRenderers.length > 0)
  328.          {
  329.             list.removeChild(activeCellRenderers.pop() as DisplayObject);
  330.          }
  331.       }
  332.       
  333.       protected function updateRendererStyles() : void
  334.       {
  335.          var _loc1_:Array = null;
  336.          var _loc2_:uint = 0;
  337.          var _loc3_:uint = 0;
  338.          var _loc4_:* = null;
  339.          _loc1_ = availableCellRenderers.concat(activeCellRenderers);
  340.          _loc2_ = _loc1_.length;
  341.          _loc3_ = 0;
  342.          while(_loc3_ < _loc2_)
  343.          {
  344.             if(_loc1_[_loc3_].setStyle != null)
  345.             {
  346.                for(_loc4_ in updatedRendererStyles)
  347.                {
  348.                   _loc1_[_loc3_].setStyle(_loc4_,updatedRendererStyles[_loc4_]);
  349.                }
  350.                _loc1_[_loc3_].drawNow();
  351.             }
  352.             _loc3_++;
  353.          }
  354.          updatedRendererStyles = {};
  355.       }
  356.       
  357.       public function set selectedItem(param1:Object) : void
  358.       {
  359.          var _loc2_:int = 0;
  360.          _loc2_ = _dataProvider.getItemIndex(param1);
  361.          selectedIndex = _loc2_;
  362.       }
  363.       
  364.       public function sortItems(... rest) : *
  365.       {
  366.          return _dataProvider.sort.apply(_dataProvider,rest);
  367.       }
  368.       
  369.       public function removeAll() : void
  370.       {
  371.          _dataProvider.removeAll();
  372.       }
  373.       
  374.       protected function handleCellRendererChange(param1:Event) : void
  375.       {
  376.          var _loc2_:ICellRenderer = null;
  377.          var _loc3_:uint = 0;
  378.          _loc2_ = param1.currentTarget as ICellRenderer;
  379.          _loc3_ = _loc2_.listData.index;
  380.          _dataProvider.invalidateItemAt(_loc3_);
  381.       }
  382.       
  383.       protected function moveSelectionVertically(param1:uint, param2:Boolean, param3:Boolean) : void
  384.       {
  385.       }
  386.       
  387.       override protected function setHorizontalScrollPosition(param1:Number, param2:Boolean = false) : void
  388.       {
  389.          var _loc3_:Number = NaN;
  390.          if(param1 == _horizontalScrollPosition)
  391.          {
  392.             return;
  393.          }
  394.          _loc3_ = param1 - _horizontalScrollPosition;
  395.          _horizontalScrollPosition = param1;
  396.          if(param2)
  397.          {
  398.             dispatchEvent(new ScrollEvent(ScrollBarDirection.HORIZONTAL,_loc3_,param1));
  399.          }
  400.       }
  401.       
  402.       public function scrollToSelected() : void
  403.       {
  404.          scrollToIndex(selectedIndex);
  405.       }
  406.       
  407.       public function invalidateItem(param1:Object) : void
  408.       {
  409.          if(renderedItems[param1] == null)
  410.          {
  411.             return;
  412.          }
  413.          invalidItems[param1] = true;
  414.          invalidate(InvalidationType.DATA);
  415.       }
  416.       
  417.       protected function handleCellRendererClick(param1:MouseEvent) : void
  418.       {
  419.          var _loc2_:ICellRenderer = null;
  420.          var _loc3_:uint = 0;
  421.          var _loc4_:int = 0;
  422.          var _loc5_:int = 0;
  423.          var _loc6_:uint = 0;
  424.          if(!_enabled)
  425.          {
  426.             return;
  427.          }
  428.          _loc2_ = param1.currentTarget as ICellRenderer;
  429.          _loc3_ = _loc2_.listData.index;
  430.          if(!dispatchEvent(new ListEvent(ListEvent.ITEM_CLICK,false,true,_loc2_.listData.column,_loc2_.listData.row,_loc3_,_loc2_.data)) || !_selectable)
  431.          {
  432.             return;
  433.          }
  434.          _loc4_ = selectedIndices.indexOf(_loc3_);
  435.          if(!_allowMultipleSelection)
  436.          {
  437.             if(_loc4_ != -1)
  438.             {
  439.                return;
  440.             }
  441.             _loc2_.selected = true;
  442.             _selectedIndices = [_loc3_];
  443.             lastCaretIndex = caretIndex = _loc3_;
  444.          }
  445.          else if(param1.shiftKey)
  446.          {
  447.             _loc6_ = _selectedIndices.length > 0 ? uint(_selectedIndices[0]) : uint(_loc3_);
  448.             _selectedIndices = [];
  449.             if(_loc6_ > _loc3_)
  450.             {
  451.                _loc5_ = _loc6_;
  452.                while(_loc5_ >= _loc3_)
  453.                {
  454.                   _selectedIndices.push(_loc5_);
  455.                   _loc5_--;
  456.                }
  457.             }
  458.             else
  459.             {
  460.                _loc5_ = _loc6_;
  461.                while(_loc5_ <= _loc3_)
  462.                {
  463.                   _selectedIndices.push(_loc5_);
  464.                   _loc5_++;
  465.                }
  466.             }
  467.             caretIndex = _loc3_;
  468.          }
  469.          else if(param1.ctrlKey)
  470.          {
  471.             if(_loc4_ != -1)
  472.             {
  473.                _loc2_.selected = false;
  474.                _selectedIndices.splice(_loc4_,1);
  475.             }
  476.             else
  477.             {
  478.                _loc2_.selected = true;
  479.                _selectedIndices.push(_loc3_);
  480.             }
  481.             caretIndex = _loc3_;
  482.          }
  483.          else
  484.          {
  485.             _selectedIndices = [_loc3_];
  486.             lastCaretIndex = caretIndex = _loc3_;
  487.          }
  488.          dispatchEvent(new Event(Event.CHANGE));
  489.          invalidate(InvalidationType.DATA);
  490.       }
  491.       
  492.       public function get length() : uint
  493.       {
  494.          return _dataProvider.length;
  495.       }
  496.       
  497.       public function get allowMultipleSelection() : Boolean
  498.       {
  499.          return _allowMultipleSelection;
  500.       }
  501.       
  502.       protected function onPreChange(param1:DataChangeEvent) : void
  503.       {
  504.          switch(param1.changeType)
  505.          {
  506.             case DataChangeType.REMOVE:
  507.             case DataChangeType.ADD:
  508.             case DataChangeType.INVALIDATE:
  509.             case DataChangeType.REMOVE_ALL:
  510.             case DataChangeType.REPLACE:
  511.             case DataChangeType.INVALIDATE_ALL:
  512.                break;
  513.             default:
  514.                preChangeItems = selectedItems;
  515.          }
  516.       }
  517.       
  518.       public function getRendererStyle(param1:String, param2:int = -1) : Object
  519.       {
  520.          return rendererStyles[param1];
  521.       }
  522.       
  523.       override protected function setVerticalScrollPosition(param1:Number, param2:Boolean = false) : void
  524.       {
  525.          var _loc3_:Number = NaN;
  526.          if(param1 == _verticalScrollPosition)
  527.          {
  528.             return;
  529.          }
  530.          _loc3_ = param1 - _verticalScrollPosition;
  531.          _verticalScrollPosition = param1;
  532.          if(param2)
  533.          {
  534.             dispatchEvent(new ScrollEvent(ScrollBarDirection.VERTICAL,_loc3_,param1));
  535.          }
  536.       }
  537.       
  538.       protected function moveSelectionHorizontally(param1:uint, param2:Boolean, param3:Boolean) : void
  539.       {
  540.       }
  541.       
  542.       public function set selectedIndices(param1:Array) : void
  543.       {
  544.          if(!_selectable)
  545.          {
  546.             return;
  547.          }
  548.          _selectedIndices = param1 == null ? [] : param1.concat();
  549.          invalidate(InvalidationType.SELECTED);
  550.       }
  551.       
  552.       public function get selectedIndex() : int
  553.       {
  554.          return _selectedIndices.length == 0 ? -1 : int(_selectedIndices[_selectedIndices.length - 1]);
  555.       }
  556.       
  557.       override protected function draw() : void
  558.       {
  559.          super.draw();
  560.       }
  561.       
  562.       override protected function configUI() : void
  563.       {
  564.          super.configUI();
  565.          listHolder = new Sprite();
  566.          addChild(listHolder);
  567.          listHolder.scrollRect = contentScrollRect;
  568.          list = new Sprite();
  569.          listHolder.addChild(list);
  570.       }
  571.       
  572.       public function addItem(param1:Object) : void
  573.       {
  574.          _dataProvider.addItem(param1);
  575.          invalidateList();
  576.       }
  577.       
  578.       protected function handleCellRendererMouseEvent(param1:MouseEvent) : void
  579.       {
  580.          var _loc2_:ICellRenderer = null;
  581.          var _loc3_:String = null;
  582.          _loc2_ = param1.target as ICellRenderer;
  583.          _loc3_ = param1.type == MouseEvent.ROLL_OVER ? ListEvent.ITEM_ROLL_OVER : ListEvent.ITEM_ROLL_OUT;
  584.          dispatchEvent(new ListEvent(_loc3_,false,false,_loc2_.listData.column,_loc2_.listData.row,_loc2_.listData.index,_loc2_.data));
  585.       }
  586.       
  587.       public function clearRendererStyle(param1:String, param2:int = -1) : void
  588.       {
  589.          delete rendererStyles[param1];
  590.          updatedRendererStyles[param1] = null;
  591.          invalidate(InvalidationType.RENDERER_STYLES);
  592.       }
  593.       
  594.       protected function handleCellRendererDoubleClick(param1:MouseEvent) : void
  595.       {
  596.          var _loc2_:ICellRenderer = null;
  597.          var _loc3_:uint = 0;
  598.          if(!_enabled)
  599.          {
  600.             return;
  601.          }
  602.          _loc2_ = param1.currentTarget as ICellRenderer;
  603.          _loc3_ = _loc2_.listData.index;
  604.          dispatchEvent(new ListEvent(ListEvent.ITEM_DOUBLE_CLICK,false,true,_loc2_.listData.column,_loc2_.listData.row,_loc3_,_loc2_.data));
  605.       }
  606.       
  607.       public function get rowCount() : uint
  608.       {
  609.          return 0;
  610.       }
  611.       
  612.       public function isItemSelected(param1:Object) : Boolean
  613.       {
  614.          return selectedItems.indexOf(param1) > -1;
  615.       }
  616.       
  617.       public function set dataProvider(param1:DataProvider) : void
  618.       {
  619.          if(_dataProvider != null)
  620.          {
  621.             _dataProvider.removeEventListener(DataChangeEvent.DATA_CHANGE,handleDataChange);
  622.             _dataProvider.removeEventListener(DataChangeEvent.PRE_DATA_CHANGE,onPreChange);
  623.          }
  624.          _dataProvider = param1;
  625.          _dataProvider.addEventListener(DataChangeEvent.DATA_CHANGE,handleDataChange,false,0,true);
  626.          _dataProvider.addEventListener(DataChangeEvent.PRE_DATA_CHANGE,onPreChange,false,0,true);
  627.          clearSelection();
  628.          invalidateList();
  629.       }
  630.       
  631.       override protected function drawLayout() : void
  632.       {
  633.          super.drawLayout();
  634.          contentScrollRect = listHolder.scrollRect;
  635.          contentScrollRect.width = availableWidth;
  636.          contentScrollRect.height = availableHeight;
  637.          listHolder.scrollRect = contentScrollRect;
  638.       }
  639.       
  640.       public function getItemAt(param1:uint) : Object
  641.       {
  642.          return _dataProvider.getItemAt(param1);
  643.       }
  644.       
  645.       override protected function initializeAccessibility() : void
  646.       {
  647.          if(SelectableList.createAccessibilityImplementation != null)
  648.          {
  649.             SelectableList.createAccessibilityImplementation(this);
  650.          }
  651.       }
  652.       
  653.       public function scrollToIndex(param1:int) : void
  654.       {
  655.       }
  656.       
  657.       public function removeItem(param1:Object) : Object
  658.       {
  659.          return _dataProvider.removeItem(param1);
  660.       }
  661.       
  662.       public function get dataProvider() : DataProvider
  663.       {
  664.          return _dataProvider;
  665.       }
  666.       
  667.       public function set maxHorizontalScrollPosition(param1:Number) : void
  668.       {
  669.          _maxHorizontalScrollPosition = param1;
  670.          invalidate(InvalidationType.SIZE);
  671.       }
  672.       
  673.       public function setRendererStyle(param1:String, param2:Object, param3:uint = 0) : void
  674.       {
  675.          if(rendererStyles[param1] == param2)
  676.          {
  677.             return;
  678.          }
  679.          updatedRendererStyles[param1] = param2;
  680.          rendererStyles[param1] = param2;
  681.          invalidate(InvalidationType.RENDERER_STYLES);
  682.       }
  683.       
  684.       public function invalidateItemAt(param1:uint) : void
  685.       {
  686.          var _loc2_:Object = null;
  687.          _loc2_ = _dataProvider.getItemAt(param1);
  688.          if(_loc2_ != null)
  689.          {
  690.             invalidateItem(_loc2_);
  691.          }
  692.       }
  693.       
  694.       public function set selectedItems(param1:Array) : void
  695.       {
  696.          var _loc2_:Array = null;
  697.          var _loc3_:uint = 0;
  698.          var _loc4_:int = 0;
  699.          if(param1 == null)
  700.          {
  701.             selectedIndices = null;
  702.             return;
  703.          }
  704.          _loc2_ = [];
  705.          _loc3_ = 0;
  706.          while(_loc3_ < param1.length)
  707.          {
  708.             if((_loc4_ = _dataProvider.getItemIndex(param1[_loc3_])) != -1)
  709.             {
  710.                _loc2_.push(_loc4_);
  711.             }
  712.             _loc3_++;
  713.          }
  714.          selectedIndices = _loc2_;
  715.       }
  716.       
  717.       public function clearSelection() : void
  718.       {
  719.          selectedIndex = -1;
  720.       }
  721.       
  722.       override public function get maxHorizontalScrollPosition() : Number
  723.       {
  724.          return _maxHorizontalScrollPosition;
  725.       }
  726.       
  727.       public function get selectedItems() : Array
  728.       {
  729.          var _loc1_:Array = null;
  730.          var _loc2_:uint = 0;
  731.          _loc1_ = [];
  732.          _loc2_ = 0;
  733.          while(_loc2_ < _selectedIndices.length)
  734.          {
  735.             _loc1_.push(_dataProvider.getItemAt(_selectedIndices[_loc2_]));
  736.             _loc2_++;
  737.          }
  738.          return _loc1_;
  739.       }
  740.       
  741.       public function set selectedIndex(param1:int) : void
  742.       {
  743.          selectedIndices = param1 == -1 ? null : [param1];
  744.       }
  745.    }
  746. }
  747.